package org.example.springboot.controller;

import org.example.springboot.model.InBound;
import org.example.springboot.model.OutBound;
import org.example.springboot.model.Products;
import org.example.springboot.service.InBoundService;
import org.example.springboot.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class InBoundController {
    @Autowired
    private InBoundService inBoundService;

    @PostMapping("/insertInBound")
    public String insertInBound(@RequestBody InBound inBound){
        return inBoundService.insertInBound(inBound.getProductName(),inBound.getModelNumber(),inBound.getSupplierName(),inBound.getQuantity(),inBound.getTotalAmount(),inBound.getInTime(),inBound.getInOrderId());
    }

    @GetMapping("/getAllInBound")
    public List<InBound> getAllInBound(){
        return inBoundService.getAllInBound();
    }

    @GetMapping("/findInBoundByKeyword/{keyword}")
    public List<InBound> findInBoundByKeyword(@PathVariable String keyword){
        return inBoundService.findInBoundByKeyword(keyword);
    }

    @GetMapping("/getInBoundById/{id}")
    public InBound getInBoundById(@PathVariable int id){
        return inBoundService.getInBoundById(id);
    }

    @DeleteMapping("/deleteInBoundById/{id}")
    public void deleteInBoundById(@PathVariable int id){
        inBoundService.deleteInBoundById(id);
    }
}
